<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>易买网</title>
    <link rel="stylesheet" type="text/css" href="./css/style.css">
</head>
<body>

    <!--头部-->
    <jsp:include page="commons/header.jsp" />

    <div id="position" class="wrap">
        <!-- 文字的导航 -->
        您现在的位置:<a href="index">首页</a>&nbsp;&gt;商品列表
    </div>

    <div id="main" class="wrap">
        <!--左侧分类-->
        <jsp:include page="commons/left.jsp" />

        <!--  特价商品&热门&新闻&公告 -->
        <div class="main">
            <!--商品信息列表-->

            <div class="product-list">
                <c:choose>

                    <c:when test="${not empty pageInfo.rows}">
                        <ul class="product clearfix">
                            <c:forEach items="${pageInfo.rows}" var="product" >
                                <li>
                                    <dl>
                                        <dt>
                                            <a href="product?id=${product.id}"><img src="${product.proPic}"></a>
                                        </dt>
                                        <dd class="title">
                                            <a href="product?id=${product.id}">${product.name}</a>
                                        </dd>
                                        <dd class="price">
                                            ￥${product.price}
                                        </dd>
                                    </dl>
                                </li>
                            </c:forEach>
                        </ul>
                    </c:when>
                    <c:otherwise>
                        <p style="text-align: center">没有查到对应的数据，请重置搜索条件！</p>
                    </c:otherwise>
                </c:choose>

<%--                总记录数：${pageInfo.totalCount} ----%>
<%--                总页数：${pageInfo.totalPages} ----%>
<%--                页码：${pageInfo.page} ----%>
<%--                每页条数：${pageInfo.pageSize}--%>

                <div class="clear"></div>
                <c:if test="${pageInfo.totalPages > 1}" >
                    <div class="pager">
                        <ul class="clearfix">
                            <c:if test="${pageInfo.page > 1 }" >
                                <li><a href="/search?page=1&bigTypeId=${bigTypeId}&smallTypeId=${smallTypeId}&keyword=${keyword}">首页</a></li>
                                <li><a href="/search?page=${pageInfo.page - 1}&bigTypeId=${bigTypeId}&smallTypeId=${smallTypeId}&keyword=${keyword}">上一页</a></li>
                            </c:if>


                            <c:forEach items="${pageInfo.navigateNums}" var="page">
                                <c:choose >
                                    <c:when test="${page == pageInfo.page}">
                                        <li>${page}</li>
                                    </c:when>
                                    <c:otherwise>
                                        <li><a href="/search?page=${page}&bigTypeId=${bigTypeId}&smallTypeId=${smallTypeId}&keyword=${keyword}">${page}</a></li>
                                    </c:otherwise>
                                </c:choose>

                            </c:forEach>

                            <c:if test="${pageInfo.page < pageInfo.totalPages}" >
                                <li><a href="/search?page=${pageInfo.page + 1}&bigTypeId=${bigTypeId}&smallTypeId=${smallTypeId}&keyword=${keyword}">下一页</a></li>
                                <li><a href="/search?page=${pageInfo.totalPages}&bigTypeId=${bigTypeId}&smallTypeId=${smallTypeId}&keyword=${keyword}">尾页</a></li>
                            </c:if>
                        </ul>
                    </div>
                </c:if>

            </div>

        </div>
        <div class="clear"></div>
    </div>

    <!--底部-->
    <jsp:include page="commons/footer.jsp" />
</body>
</html>
